import './index.scss'
import { microCreateMinis } from '../../minis'

export default {
  name: 'textArea',
  mixins: [microCreateMinis],
  data() {
    return {
      tabActive: 0,
      formData: {
        text: '文本内容',
        align: 'left',
        fontSize: '24',
        fontType: [],
        textColor: '#464646',
        bgColor: '#FFFFFF',
        marginTop: '15',
        marginBottom: '15'
      },
      commonCheckFieldRules: 'checkData'
    }
  },
  computed: {
    fontBold() {
      return this.formData.fontType.indexOf('1') !== -1
    },
    fontStyle() {
      return this.formData.fontType.indexOf('2') !== -1
    },
    fontDecoration() {
      return this.formData.fontType.indexOf('3') !== -1
    }
  },
  methods: {
    // 重置颜色
    resetBoderColor(type) {
      if (type === 1) {
        this.formData.textColor = '#464646'
      } else if (type === 2) {
        this.formData.bgColor = '#FFFFFF'
      }
    },
    checkData() {
      let is = true
      if (!this.formData.text) {
        is = false
        this.$message.error('请添加文本内容')
      }
      this.myCheckResult(is);
    },
  }
}
